package com.zch.enum_;

/**
 * enum类
 */
public class Enumeration02 {
    public static void main(String[] args) {
        System.out.println(Season2.WINTER);
        System.out.println(Season2.AUTUMN);
        System.out.println(Season2.SUMMER);
        System.out.println(Season2.SPRING);
    }
}

/*
    默认继承Enum类，且类型为final
    使用enum关键字后不能再继承其它类
    枚举类和普通类一样可以实现接口
 */
enum Season2 {
    SPRING("春天", "温暖"), WINTER("冬天", "寒冷"), AUTUMN("秋天", "凉爽"), SUMMER("夏天", "炎热"), /*What*/; //
    //使用无参构造创建枚举对象，则实参列表和括号都可省略
    private String name;
    private String desc;

    private Season2() {}

    private Season2(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return "Season2{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }
}